import Vue from "vue"
import axios from "axios"

import Foodlist from '@/components/Foodlist'
export default { 
	components:{
    	'Foodlistm':Foodlist ,  	    	
  },
  data () {
    return {
      tradename:'金樽食府',
      evanumber:0,
      food:{},
      id:localStorage["cpid"],
      evaluations:[],
      inputdata:5,
      foods:[],
      cartfoods:[],
      totalprice:0,
      numbers:0,
      buynumber:1,
    }
  },
  created() {
  	
		axios.get('/api/dishInfo?id='+this.id).then((res) => {
		    this.food = res.data;		      		     
		    console.log(this.food)		      
		});	
		axios.get('/api/dishesReviews?cpid='+this.id).then((res) => {
		    this.evaluations = res.data;
		    this.evanumber=this.evaluations.length;		    
		    this.inputdata=this.evaluations[0].plxj;
		    console.log(this.evaluations);		      
		});
		axios.get('/api/dishesList').then((res) => {
	      this.foods = res.data;	     
		})
	
  },
  watch: {
    '$route' (to, from) {
    }
  },
  methods:{   
	    addcart: function (food){
	    	sessionStorage["zt"]=1;
	    	axios.get('/api/diancai?cpid='+food.id).then((r) => {
	    		
	    	})
			      
	    },
	    tofood: function (){ 
		 window.location.reload();
	    }, 
	}
}